<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/iconfont.css" />
    <style type="text/css">
        .iconfont {
            font-size: 1rem;
            color: #000;
        }

        .aui-btn.aui-pull-right.hidden,
        .hidden {
            display: none;
        }

        .news_mail_add {
            float: right;
        }

        .news_mail_add img {
            width: 1rem;
            margin: 0.7rem 0.5rem 0 0;
        }

        .aui-bar-nav {
            background: #fff;
        }

        .aui-bar-nav .aui-btn .aui-iconfont {
            color: #000;
        }

        .aui-bar-nav .aui-title {
            color: #000;
        }

        .aui-btn.aui-pull-right {
            color: #000;
            font-size: 0.65rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav header" id="aui-header">
        <a class="aui-btn aui-pull-left" tapmode onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div id="frametitle" class="aui-title"></div>
        <a class="aui-btn aui-pull-right hidden" id="detaillist" tapmode onclick="do_open_detailist()">
            处理记录
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_search" style="color:#fff;font-size: 0.6rem;" tapmode onclick="do_open_search()">
            <i class="icon iconfont icon-search"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_gatehistory" tapmode onclick="do_open_gatehistory()">
            门岗记录
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_qualitycontrol" tapmode onclick="do_open_qualityhistory()">
            历史记录
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_neibubaoshiadd" tapmode onclick="do_open_neibubaoshi()">
            历史记录
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_service_jindu" tapmode onclick="do_open_service_jindu()">
            工单进度
        </a>
        <div class="aui-btn aui-pull-right hidden" v-on:click="open_mail()" id="right_book">
            <i class="icon iconfont icon-jia"></i>
        </div>
        <div class="aui-btn aui-pull-right hidden" tapmode onclick="do_open_edit()" id="right_edit">
            <i class="icon iconfont icon-bianji"></i>
        </div>
    </header>
</body>
<script type="text/javascript" src="./script/api.js "></script>
<script type="text/javascript" src="./script/common.js "></script>
<script type="text/javascript">
    window._onclose = null;
    window.closeWin = function() {
        if (window._onclose) {
            api.execScript({
                name: api.winName,
                frameName: "main",
                script: window._onclose
            });
        } else {
            api.closeWin();
        }
    };
    window.do_open_search = function() {
        var searchtype = api.pageParam.searchtype || 0; //1-收费明细查询 2-工单明细查询
        api.sendEvent({
            name: 'do_open_search',
            extra: {
                searchtype: searchtype
            }
        });
    }
    window.do_open_detailist = function() {
        api.sendEvent({
            name: 'do_open_detailist'
        });
    }
    window.do_open_edit = function() {
        api.sendEvent({
            name: 'do_open_edit'
        });
    }
    window.do_open_gatehistory = function() {
        api.sendEvent({
            name: 'do_open_gatehistory'
        });
    }
    window.do_open_qualityhistory = function() {
        api.sendEvent({
            name: 'do_open_qualityhistory'
        });
    }
    window.do_open_neibubaoshi = function() {
        api.sendEvent({
            name: 'do_open_neibubaoshi'
        });
    }
    window.do_open_service_jindu = function() {
        api.sendEvent({
            name: 'do_open_service_jindu'
        });
    }
    apiready = function() {
        var header = $api.byId('aui-header');
        $api.fixStatusBar(header);
        var headerH = $api.offset(header).h;
        var frameH = api.winHeight;
        var url = api.pageParam.url;
        var title = api.pageParam.title;
        var type = api.pageParam.type;
        var edit = api.pageParam.edit;
        if (url && url.length > 0 && url[0] != '.' && url[0] != '/' && url[0] != '\\') {
            if (url.indexOf('http://') < 0 && url.indexOf('https://') < 0) {
                url = url.replace('_win', '_frm');
                url = 'html/' + url;
            }
        }
        if (url.indexOf('scanner_frm') == -1) {
            api.sendEvent({
                name: 'do_close_scanner',
            });
        }
        if (url.indexOf('chooseproject_frm') == -1) {
            api.sendEvent({
                name: 'closechooseproject',
            });
        }
        if (url.indexOf('gate_sentry_frm') > -1) {
            $api.toggleCls($api.byId('right_gatehistory'), 'hidden');
        }
        if (url.indexOf('qualitycontrol_frm') > -1) {
            $api.toggleCls($api.byId('right_qualitycontrol'), 'hidden');
        }
        if (url.indexOf('neibubaoshi_add_frm') > -1) {
            $api.toggleCls($api.byId('right_neibubaoshiadd'), 'hidden');
        }
        if (url.indexOf('customerservicelist_frm') > -1) {
            $api.toggleCls($api.byId('right_service_jindu'), 'hidden');
        }
        var searchtype = api.pageParam.searchtype || 0; //1-收费明细查询 2-工单明细查询
        if (searchtype > 0) {
            $api.toggleCls($api.byId('right_search'), 'hidden');
        }
        if (url.indexOf('home_news_mail_frm') > -1) {
            $api.toggleCls($api.byId('right_book'), 'hidden');
        }
        if (url.indexOf('resources_detail_frm') > -1) {
            $api.toggleCls($api.byId('right_edit'), 'hidden');
        }
        var pageParam = {
            header_h: headerH,
        }
        Object.keys(api.pageParam).forEach(function(key) {
            if (key != 'title' && key != 'url') {
                pageParam[key] = api.pageParam[key];
            }
        });
        window._onclose = api.pageParam.onclose;
        api.openFrame({
            name: "main",
            url: url,
            bounces: false,
            pageParam: pageParam,
            rect: {
                x: 0,
                y: headerH,
                w: 'auto',
                h: frameH - headerH,
            }
        });
        $api.dom(header, '#frametitle').innerText = title;
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            if (ret) {
                window.closeWin();
            }
        });
    };
</script>

</html>
